package com.chenyue.cm.match.dao.ex;

import com.chenyue.cm.live.vo.LiveUserMatchHistory;
import com.chenyue.cm.match.dao.provider.MatchLiveUserProvider;
import com.chenyue.cm.match.domain.JdMatchFormatMember;
import com.chenyue.cm.match.vo.MatchScore;
import com.chenyue.cm.match.vo.MatchScoreList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author libingxing
 */

@Mapper
@Repository
public interface MatchLiveUserMapperEx {

    /**
     * 查询参赛历史
     *
     * @param userId      用户id
     * @param convertPage 分页内容
     * @return list
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "liveUserMatchHistoryList")
    List<LiveUserMatchHistory> liveUserMatchHistoryList(Integer userId, String convertPage);

    /**
     * 获取参赛员历史总分
     *
     * @param id 参赛员userId
     * @return 最高总分
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "historyRecordRank")
    Integer historyRecordRank(Integer id);

    /**
     * 获取参赛员历史排名
     *
     * @param id 参赛员userId
     * @return 最高排名
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "historyRecordScore")
    Integer historyRecordScore(Integer id);

    /**
     * 查询直播间分配的团队
     *
     * @param recordId 直播id
     * @param itemId   项目id
     * @param page     分页参数
     * @return MatchMemberList
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "matchGroupScoreList")
    List<MatchScoreList.MatchGroupList> matchGroupScoreList(Integer recordId, Integer itemId, String page);

    /**
     * 查询直播间分配的团队
     *
     * @param recordId 直播id
     * @param itemId   项目id
     * @return MatchMemberList
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "matchGroupScoreListCount")
    int matchGroupScoreListCount(Integer recordId, Integer itemId);

    /**
     * 查询直播间参赛员
     *
     * @param recordId 直播id
     * @param itemId   项目id
     * @param groupId  分组id
     * @return MatchMemberList
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "matchMemberScoreList")
    List<MatchScoreList.MatchMemberList> matchMemberScoreList(Integer recordId, Integer itemId, Integer groupId, String page);

    /**
     * 查询直播间参赛员
     *
     * @param recordId 直播id
     * @param itemId   项目id
     * @param groupId  分组id
     * @return MatchMemberList
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "matchMemberScoreListCount")
    int matchMemberScoreListCount(Integer recordId, Integer itemId, int groupId);

    /**
     * 查询直播间分配的团队
     *
     * @param formatId 直播id
     * @param itemId   项目id
     * @return MatchMemberList
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "handlePromotionGroupList")
    List<MatchScoreList.MatchGroupList> handlePromotionGroupList(String formatId, Integer itemId);

    /**
     * 查询直播间参赛员
     *
     * @param formatId 直播id
     * @param itemId   项目id
     * @param groupId  分组id
     * @return MatchMemberList
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "handlePromotionScoreList")
    List<MatchScoreList.MatchMemberList> handlePromotionScoreList(String formatId, Integer itemId, Integer groupId);

    /**
     * 单项成绩 核算 排序
     *
     * @param id 赛程id
     * @return 赛程排名
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "multiCalculate")
    List<JdMatchFormatMember> multiCalculate(Integer id);

    /**
     * 多项成绩（取两项最高） 核算 排序
     *
     * @param id 赛程id
     * @return 赛程排名
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "singleCalculate")
    List<JdMatchFormatMember> singleCalculate(Integer id);

    /**
     * 后台查询赛程成绩
     * @param formatId 赛程id
     * @return MatchScore
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "getMatchScoreList")
    List<MatchScore> getMatchScoreList(Integer formatId,Integer page,Integer rows);

    /**
     * 后台查询赛程成绩
     * @param formatId 赛程id
     * @return long
     */
    @SelectProvider(type = MatchLiveUserProvider.class, method = "getMatchScoreListCount")
    long getMatchScoreListCount(Integer formatId);
}
